{template 'header'}
<script type="text/javascript" src="{DT_STATIC}file/script/admin.js"></script>
<link rel="stylesheet" type="text/css" href="http://dangjian.hnr.cn/admin/image/style.css"/>
{if $itemid}
<div class="m">	
	{if $page == 2}
	<div style="margin:20px;">
		<div class="submit_success">
		提交成功，感谢您的参与！&nbsp;&nbsp;&nbsp;&nbsp;
		<a href="{$back}" class="b">返回</a>
		</div>
	</div>
	{else}
	<h1 class="title">{$title}</h1>
	<div class="info f_gray">
	<span class="f_r">浏览：{$hits}</span>
	添加时间：{$adddate}&nbsp;&nbsp;&nbsp;&nbsp;有效期：{$fromdate} 至 {$todate}&nbsp;&nbsp;&nbsp;&nbsp;<img src="{DT_STATIC}file/image/process_{get_process($fromtime, $totime)}.gif" align="absmiddle"/>
	</div>
	{if $content}<div class="content">{$content}</div>{else}<div class="b20"></div>{/if}
	{if $lists}
	<form action="{$url}index.php" method="post" onsubmit="return check();">		
	<input type="hidden" name="itemid" value="{$itemid}"/>
	<input type="hidden" name="item" value="{$item}"/>
	<div class="{if $display}survey{else}form{/if}">
	<table width="100%" cellpadding="10" cellspacing="0">
	{loop $lists $k $v}
	<tr>
	<td class="f_1"><span class="f_0">{$k+1}. </span>{$v[name]}{if $v[min]} <span class="f_red">*</span>{/if}</td>
	{if $display}
	</tr>
	<tr>
	{/if}
	<td class="f_2">
	{if $v[type] == 0}
	<input type="text" name="a[{$v[qid]}]" id="q_{$v[qid]}"{$v[extend]}/> <span id="dq_{$v[qid]}" class="f_red"></span>
	{elseif $v[type] == 1}
	<textarea name="a[{$v[qid]}]" id="q_{$v[qid]}"{$v[extend]}></textarea><br/><span id="dq_{$v[qid]}" class="f_red"></span>
	{elseif $v[type] == 2}
	<select name="a[{$v[qid]}]" id="q_{$v[qid]}"{$v[extend]}>
	<option value="">请选择</option>
	{loop $v[option] $kk $vv}
	<option value="{$vv[name]}"{if $vv[on]} selected{/if}>{$vv[name]}</option>
	{/loop}
	</select> <span id="dq_{$v[qid]}" class="f_red"></span>
	{elseif $v[type] == 3}
	<ul id="q_{$v[qid]}"{$v[extend]}>
	{loop $v[option] $kk $vv}
	<li class="f_3"><input type="checkbox" name="a[{$v[qid]}][]" value="{$vv[name]}" id="q_{$v[qid]}_{$kk}" {if $vv[on]} checked{/if}/><label for="q_{$v[qid]}_{$kk}">{$vv[name]}{if $vv[name] == '其他'} <input type="text" name="o[{$v[qid]}]" id="other_{$v[qid]}" size="10" onfocus="Dd('q_{$v[qid]}_{$kk}').checked=true;"/>{/if}</label>		
	</li>
	{/loop}
	</ul><br class="c_b"/><span id="dq_{$v[qid]}" class="f_red"></span>
	{elseif $v[type] == 4}
	<ul id="q_{$v[qid]}"{$v[extend]}>
	{loop $v[option] $kk $vv}
	<li class="f_3"><input type="radio" name="a[{$v[qid]}]" value="{$vv[name]}" id="q_{$v[qid]}_{$kk}" {if $vv[on]} checked{/if}/><label for="q_{$v[qid]}_{$kk}">{$vv[name]}{if $vv[name] == '其他'} <input type="text" name="o[{$v[qid]}]" id="other_{$v[qid]}" size="10" onfocus="Dd('q_{$v[qid]}_{$kk}').checked=true;"/>{/if}</label></li>
	{/loop}
	</ul><br class="c_b"/><span id="dq_{$v[qid]}" class="f_red"></span>
	{elseif $v[type] == 5}
	<input name="a[{$v[qid]}]" type="text" size="50" id="q_{$v[qid]}" value="" />&nbsp;&nbsp;<span onclick="Dfile(21, Dd('q_{$v[qid]}').value, 'q_{$v[qid]}');" class="jt">[上传]</span>&nbsp;&nbsp;<span onclick="if(Dd('q_{$v[qid]}').value) window.open(Dd('q_{$v[qid]}').value);" class="jt">[预览]</span>&nbsp;&nbsp;<span onclick="Dd('q_{$v[qid]}').value='';" class="jt">[删除]</span> <span id="dq_{$v[qid]}" class="f_red"></span>
	{/if}		
	</td>
	</tr>
	{/loop}
	</table>
	</div>
	<table width="100%" cellpadding="10" cellspacing="0">
	{if $verify == 1 && !$error}
	<tr>
	<td align="right"><span class="f_red">*</span> 验证码&nbsp;&nbsp;</td>
	<td>{template 'captcha', 'chip'} <span id="dcaptcha" class="f_red"></span></td>
	</tr>
	{/if}
	{if $verify == 2 && !$error}
	<tr>
	<td align="right"><span class="f_red">*</span> 验证问题&nbsp;&nbsp;</td>
	<td>{template 'question', 'chip'} <span id="danswer" class="f_red"></span></td>
	</tr>
	{/if}
	<tr>
	<td width="200" height="64"></td>
	<td>
	{if $error == 5}
	<span class="px14">您还没有登录，请先 <a href="{$MODULE[2][linkurl]}{$DT[file_login]}" class="b">登录</a> 或 <a href="{$MODULE[2][linkurl]}{$DT[file_register]}" class="b">注册</a></span>
	{elseif $error == 4}
	<span class="f_red px14">当前会员组无提交权限</span>
	{elseif $error == 3}
	<span class="f_red px14">未开始</span>
	{elseif $error == 2}
	<span class="f_red px14">已过期</span>
	{elseif $error == 1}
	<span class="f_red px14">已提交过</span>
	{else}
	<input type="submit" name="submit" value=" 提 交 " class="btn-blue"/>
	{/if}
	</td>
	</tr>
	</table>
	</form>
	{/if}
	<div class="b20"></div>
	{/if}
</div>
{else}
<div class="m m1">
	<div class="m1l">
		<table cellpadding="16" cellspacing="0" class="tb">
		<tr>
		{if !$typeid}<th width="120">类别</th>{/if}
		<th>标题</th>
		<th width="120">点击</th>
		<th width="120">发布时间</th>
		</tr>
		{loop $lists $k $v}
		<tr align="center">
		{if !$typeid}<td class="px14"><a href="{$url}{list_url($v[typeid])}">{$v[typename]}</a></td>{/if}
		<td align="left" class="px14"><a href="{$v[linkurl]}">{$v[title]}</a></td>
		<td class="f_gray">{$v[hits]}</td>
		<td class="f_gray">{$v[adddate]}</td>
		</tr>
		{/loop}
		</table>
		{if $pages}<div class="pages">{$pages}</div>{/if}
	</div>
	<div class="m1r side">
		<ul>
		<li class="side_li" id="type_0"><a href="{$url}">表单问卷</a></li>
		{loop $_TP[0] $v0}
		<li class="side_li" id="type_{$v0[typeid]}"><a href="{$url}{list_url($v0[typeid])}">{$v0[typename]}</a></li>
			{if isset($_TP[1][$v0[typeid]])}
			{loop $_TP[1][$v0[typeid]] $v1}
			<li class="side_li" id="type_{$v1[typeid]}"><a href="{$url}{list_url($v1[typeid])}">&nbsp;|-- {$v1[typename]}</a></li>
			{/loop}
			{/if}
		{/loop}
		</ul>
		<form action="index.php"><input type="search" name="kw" value="{$kw}" ondblclick="if(this.value){Go('./');}" placeholder="搜索" title="输入关键词，按回车搜索"/></form>
	</div>
	<div class="c_b"></div>
</div>
<script type="text/javascript">$(function(){$('#type_{$typeid}').attr('class', 'side_on');});</script>
{/if}
{if $itemid}
<script type="text/javascript">
function check() {
	var l;
	var f;
	{loop $lists $k $v}
	{if $v[min]}
	f = 'q_{$v[qid]}';
	{if $v[type] == 0 || $v[type] == 1}
	l = Dd(f).value.length;
	if(l < {$v[min]}) {
		Dmsg('{$v[name]}最少{$v[min]}字', f);
		return false;
	}
	{if $v[max]}
	if(l > {$v[max]}) {
		Dmsg('{$v[name]}最多{$v[max]}字', f);
		return false;
	}
	{/if}
	{elseif $v[type] == 2}
	l = Dd(f).value.length;
	if(l == 0) {
		Dmsg('请选择{$v[name]}', f);
		return false;
	}
	{elseif $v[type] == 3}
	l = checked_count(f);
	if(l < {$v[min]}) {
		Dmsg('{$v[name]}最少选择{$v[min]}项', f, 1);
		return false;
	}
	{if $v[max]}
	if(l > {$v[max]}) {
		Dmsg('{$v[name]}最多选择{$v[max]}项', f, 1);
		return false;
	}
	{/if}
	{elseif $v[type] == 4}
	l = checked_count(f);
	if(l == 0) {
		Dmsg('请选择{$v[name]}', f, 1);
		return false;
	}
	{/if}
	{/if}
	{/loop}
	{if $verify == 1}
	f = 'captcha';
	if($('#c'+f).html().indexOf('ok.png') == -1) {
		Dmsg('请填写验证码', f);
		return false;
	}
	{/if}
	{if $verify == 2}
	f = 'answer';
	if($('#c'+f).html().indexOf('ok.png') == -1) {
		Dmsg('请回答验证问题', f);
		return false;
	}
	{/if}
	return true;
}
</script>
{/if}
{template 'footer'}